package com.apobates.jforum2.troll.replies.biz.impl.api;

import com.apobates.jforum2.troll.replies.RepliesFeignClientConfig;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * 回复内部服务客户端
 * @author xiaofanku
 * @since 20210413
 */
@Component
@FeignClient(value="TROLL-GATEWAY", configuration = RepliesFeignClientConfig.class)
@RequestMapping("/")
public interface PostsFeignServiceApi {
    // 话题回复:
    // 更新话题统计的最近回复
    @PutMapping(value="/topic/{id}/stats/update", consumes="application/x-www-form-urlencoded")
    ResponseEntity<String> updateStatsRecentReply(
            @PathVariable("id")long topicId,
            @RequestParam("posts")long recentPostsId,
            @RequestParam("member")long recentPostsMemberId,
            @RequestParam("nickname")String recentPostsMemberNickname);

    // 话题回复:
    // 更新版块统计的回复数量
    @PutMapping(value="/board/{id}/stats/update/replies", consumes="application/x-www-form-urlencoded")
    ResponseEntity<String> updateStatsReplies(@PathVariable("id")long boardId, @RequestParam("topic")long recentTopicId, @RequestParam("posts")long recentPostsId);
}
